package com.mingqijia.gassafety.db.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mingqijia.gassafety.db.entity.annotation.OperateLogFiled;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author wanghai
 * @since 2022-03-10
 */
@Data
@TableName("cm_join_info")
@ApiModel(value="cmJoinInfo对象", description="")
public class CmJoinInfo {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "主键id")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @ApiModelProperty(value = "父级id")
    @TableField("p_id")
    private String pId;

    @ApiModelProperty(value = "燃气公司名称")
    @TableField("sp_name")
    private String spName;

    @ApiModelProperty(value = "归属区域ID")
    @TableField("region_id")
    private Integer regionId;

    @ApiModelProperty(value = "经度")
    @TableField("lon")
    private BigDecimal lon;

    @ApiModelProperty(value = "维度")
    @TableField("lat")
    private BigDecimal lat;

    @ApiModelProperty(value = "厨房用户数量")
    @TableField("sk_user_nums")
    private Integer skUserNums;

    @ApiModelProperty(value = "报警器用户数量")
    @TableField("gssc_user_nums")
    private Integer gsscUserNums;

    @ApiModelProperty(value = "报警器民用用户数")
    @TableField("gssc_user_num_m")
    private Integer gsscUserNumM;

    @ApiModelProperty(value = "报警器工商用户数")
    @TableField("gssc_user_num_g")
    private Integer gsscUserNumG;

    @ApiModelProperty(value = "最近一次更新来源;0智慧厨房，1报警器平台")
    @TableField("update_source")
    private String updateSource;

    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    private Date updateTime;

    @ApiModelProperty(value = "燃气公司名称")
    @TableField("create_time")
    private Date createTime;

    public int sumValues() {
        return skUserNums + gsscUserNums;
    }


    /**
     * 民用
     * @return
     */
    public int sumMValues() {
        return skUserNums + gsscUserNumM;
    }

    /**
     * 工商业
     * @return
     */
    public int sumGValues() {
        return gsscUserNumG;
    }

}
